PROP_0,
PROP_ACTIVE,
PROP_INCONSISTENT,
- PROP_DRAW_INDICATOR
+ PROP_DRAW_INDICATOR,
+ NUM_PROPERTIES
};
+static GParamSpec *toggle_button_props[NUM_PROPERTIES] = { NULL, };
static gboolean gtk_toggle_button_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);
class->toggled = NULL;
- g_object_class_install_property (gobject_class,
- PROP_ACTIVE,
- g_param_spec_boolean ("active",
- P_("Active"),
- P_("If the toggle button should be pressed in"),
- FALSE,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (gobject_class,
- PROP_INCONSISTENT,
- g_param_spec_boolean ("inconsistent",
- P_("Inconsistent"),
- P_("If the toggle button is in an \"in between\" state"),
- FALSE,
- GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
-
- g_object_class_install_property (gobject_class,
- PROP_DRAW_INDICATOR,
- g_param_spec_boolean ("draw-indicator",
- P_("Draw Indicator"),
- P_("If the toggle part of the button is displayed"),
- FALSE,
- GTK_PARAM_READWRITE));
+ toggle_button_props[PROP_ACTIVE] =
+ g_param_spec_boolean ("active",
+ P_("Active"),
+ P_("If the toggle button should be pressed in"),
+ FALSE,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ toggle_button_props[PROP_INCONSISTENT] =
+ g_param_spec_boolean ("inconsistent",
+ P_("Inconsistent"),
+ P_("If the toggle button is in an \"in between\" state"),
+ FALSE,
+ GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
+
+ toggle_button_props[PROP_DRAW_INDICATOR] =
+ g_param_spec_boolean ("draw-indicator",
+ P_("Draw Indicator"),
+ P_("If the toggle part of the button is displayed"),
+ FALSE,
+ GTK_PARAM_READWRITE);
+
+ g_object_class_install_properties (gobject_class, NUM_PROPERTIES, toggle_button_props);
/**
* GtkToggleButton::toggled:
if (gtk_widget_get_visible (GTK_WIDGET (toggle_button)))
gtk_widget_queue_resize (GTK_WIDGET (toggle_button));
- g_object_notify (G_OBJECT (toggle_button), "draw-indicator");
+ g_object_notify_by_pspec (G_OBJECT (toggle_button), toggle_button_props[PROP_DRAW_INDICATOR]);
/* Make toggle buttons conditionally have the "button"
* class depending on draw_indicator.
if (priv->active != is_active)
{
gtk_button_clicked (GTK_BUTTON (toggle_button));
- g_object_notify (G_OBJECT (toggle_button), "active");
+ g_object_notify_by_pspec (G_OBJECT (toggle_button), toggle_button_props[PROP_ACTIVE]);
}
}
else
gtk_widget_unset_state_flags (GTK_WIDGET (toggle_button), GTK_STATE_FLAG_INCONSISTENT);
- g_object_notify (G_OBJECT (toggle_button), "inconsistent");
+ g_object_notify_by_pspec (G_OBJECT (toggle_button), toggle_button_props[PROP_INCONSISTENT]);
}
}
gtk_toggle_button_toggled (toggle_button);
- g_object_notify (G_OBJECT (toggle_button), "active");
+ g_object_notify_by_pspec (G_OBJECT (toggle_button), toggle_button_props[PROP_ACTIVE]);
if (GTK_BUTTON_CLASS (gtk_toggle_button_parent_class)->clicked)
GTK_BUTTON_CLASS (gtk_toggle_button_parent_class)->clicked (button);